#include <stdio.h>

long long int fibo(int n) {
    if (n <= 0) {
        return 0;
    } else if (n == 1 || n == 2) {
        return 1;
    } else {
        long long int a = 1, b = 1, fib = 0;
        for(int i = 3; i <= n; i++) {
            fib = (a + b) % 10007;
            a = b;
            b = fib;
        }
        return fib;
    }
}

int main(int argc, char const *argv[])
{
    printf("%lld\n", fibo(42));
    return 0;
}
